﻿using HikVisionTool.DAL;
using HikVisionTool.Helper;
using HikVisionTool.Model;
using MesTool;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 通用过站与数采.BLL
{
    class MesBLL
    {
        private HikVisonDAL hikVisonDAL = new HikVisonDAL();
        private UserDAL userDAL = new UserDAL();

        public bool CheckWknum(ref string order, string wknum, ref string errMsg)
        {
            if (order == "")
            {
                order = wknum;
            }
            if (wknum != order)
            {
                errMsg = "订单不一致!";
                return false;
            }
            return true;
        }

        public bool OperationCheck(string serial, string operation, ref string errMsg, ref string wknum)
        {
            return OperationBLL.OperationCheck(serial, operation, ref errMsg, ref wknum);
        }

        public bool PostCheckdata(MesTool.Model.HttpModel.CheckdataDto postModel, ref string errMsg)
        {
            return OperationBLL.PostCheckdata(postModel, ref errMsg);
        }

        public bool PostBarcodestatus(MesTool.Model.HttpModel.BarcodestatusDto postModel, ref string errMsg)
        {
            return OperationBLL.PostBarcodestatus(postModel, ref errMsg);
        }
        public List<Sql5Helper.t_org_tree> GetIPCLines()
        {
            try
            {
                return hikVisonDAL.GetIPCLines();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List<Sql5Helper.t_org_tree> GetThtLines()
        {
            try
            {
                return hikVisonDAL.GetTHTLines();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool Sql3Check()
        {
            return hikVisonDAL.sql3Helper.SqlCheck();
        }
        public MesTool.Model.UserModel GetUser(string jobnumber,ref string err)
        {
            try
            {
                return MesTool.UserBLL.GetUserName(jobnumber,ref err);
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
    }
}
